package cn.jbolt.ndemo.entity;


import cn.jbolt.ndemo.CustomerRecordLevel;
import cn.jbolt.ndemo.CustomerRecordType;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;

import java.io.Serializable;
import java.util.Date;

@TableName("ja_demo_customer_record")
public class CustomerRecord implements Serializable{
    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.ASSIGN_ID)
    private Long id;

    @Schema(name = "customerName", description = "客户姓名")
    @TableField("customer_name")
    private String customerName;

    @Schema(name = "content", description = "跟进内容")
    @TableField("content")
    private String content;

    @Schema(name = "type", description = "跟进类型")
    @TableField("type")
    private String type;

    @Schema(name = "level", description = "重要程度")
    @TableField("level")
    private String level;


    @Schema(name = "createTime", description = "创建时间")
    @JsonFormat(locale = "zh", pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private Date createTime;


    //以下是非数据库字段
    @Schema(name = "typeName", description = "跟进类型名称")
    @TableField(exist = false)
    private String typeName;

    @Schema(name = "levelName", description = "重要程度名称")
    @TableField(exist = false)
    private String levelName;



    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getCustomerName() {
        return customerName;
    }

    public void setCustomerName(String customerName) {
        this.customerName = customerName;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getLevel() {
        return level;
    }

    public void setLevel(String level) {
        this.level = level;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public String getTypeName() {
        return CustomerRecordType.getByCode(type).getDescription();
    }

    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }

    public String getLevelName() {
        return CustomerRecordLevel.getByCode(level).getDescription();
    }

    public void setLevelName(String levelName) {
        this.levelName = levelName;
    }
}


